#ifndef LVGL_API_H
#define LVGL_API_H
#include "MY_QT_DEF.h"

void drawPoint(int x,int y,unsigned short color);
void fillRect(int x1,int y1,int x2,int y2,unsigned short color);
void drawLine(int x1,int y1,int x2,int y2,unsigned short color);

class LVGL_API_Class;
class LVGL_API_Class: public QObject
{
    Q_OBJECT

public:
    int Touch_x;
    int Touch_y;
    int Touch;

    MY_Display *display;
    LVGL_API_Class(MY_Display *dis=nullptr)
    {
        Touch=0;
        if(dis!=nullptr)
        {
            display=dis;
            connect(display, SIGNAL(mouse_signal(int,QPoint)),this, SLOT(TouchEvent(int,QPoint)),Qt::QueuedConnection);
            emit display->goto_setStyle(0);
        }
    }
    ~LVGL_API_Class(void)
    {

    }
public slots:
    void TouchEvent(int mode,QPoint p)
    {
        if(mode==2)
        {
            Touch=0;
        }
        else
        {
            Touch=1;
        }

        Touch_x=p.x();
        Touch_y=p.y();
    }
};

extern LVGL_API_Class *LVGL_API;

void Init_LVGL_API(MY_Display *dis);

#endif // LVGL_API_H
